#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define N 6
int main()
{
    int i,j,k,t;
    printf(" the possible latin squares of order %d are \n",N);
    for(j=0;j<N;j++)
    {
    for(i=0;i<N;i++)
    {
    t=(i+j)%N;
    for(k=0;k<N;k++)
    printf(" %d",(k+t)%N+1);
    printf("\n");
    }
    printf("\n");
}
}
